package com.mayp.supermarket.sales.policy;

/**
 * @Description :具体的促销策略
 * @Author : mayp
 * @Date: 2024/7/12  11:19
 */
public class DiscountStrategy implements PricingStrategy {

    // 折扣率
    private final double discountRate;

    public DiscountStrategy(double discountRate) {
        this.discountRate = discountRate;
    }

    @Override
    public double applyDiscount(double totalPrice) {
        return totalPrice * discountRate;
    }
}
